package com.jbm.enterapplication.activityhome.mode

import com.jbm.enterapplication.InterfaceMa
import com.jbm.enterapplication.utlisclass.HttpNet
import com.jbm.onehome.common.OHInterface
import com.jbm.onehome.iface.IEGuardKeyCtrl
import rx.Observable
import rx.Observer

/**
 * Created by 家帮忙 on 2017/9/4.
 */
class Open_Mode :Open_Mode_In<IEGuardKeyCtrl>{
    override fun getOpenDoorKey(oclick: InterfaceMa<IEGuardKeyCtrl>) {
        HttpNet.getInstans().obsevice(Observable.create(Observable.OnSubscribe <IEGuardKeyCtrl>{ obDoorKey->
         obDoorKey.onNext(  OHInterface.getG_server().GetMyEGuardKey())
        })).subscribe(object :Observer<IEGuardKeyCtrl>{
            override fun onError(e: Throwable?) {

            }

            override fun onCompleted() {
            }

            override fun onNext(t: IEGuardKeyCtrl?) {
                  oclick.onSuccess(t!!,false)




            }

        })






    }
}